home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 December / MACPOWER-1997-12.ISO.7z / MACPOWER-1997-12.ISO / AMUG / PROGRAMMING / Raven 1.2.sit / Raven 1.2 / • Extras • / SGI STL / stlcomp.h < prev    next >
C/C++ Source or Header  |  1997-09-01  |  13KB  |  411 lines

  1. /*
  2.  *
  3.  * Copyright (c) 1997
  4.  * Moscow Center for SPARC Technology
  5.  *
  6.  * Permission to use, copy, modify, distribute and sell this software
  7.  * and its documentation for any purpose is hereby granted without fee,
  8.  * provided that the above copyright notice appear in all copies and
  9.  * that both that copyright notice and this permission notice appear
  10.  * in supporting documentation.  Moscow Center for SPARC Technology makes no
  11.  * representations about the suitability of this software for any
  12.  * purpose.  It is provided "as is" without express or implied warranty.
  13.  *
  14.  */
  15.  
  16. #ifndef __STLCOMP_H
  17. # define __STLCOMP_H
  18.  
  19. //==========================================================
  20. // Features selection
  21.  
  22. // Uncomment that to disable exception handling
  23. // #  define __STL_NO_EXCEPTIONS 1
  24.  
  25. // Uncomment that to disable std namespace usage
  26. // #  define __STL_NO_NAMESPACES 1
  27.  
  28. // Comment that to not include defalloc.h ( no defaults changed )
  29. #  define    __STL_USE_DEFALLOC   1
  30.  
  31. // Uncomment that to to use new-based allocator as default
  32. // #  define    __STL_USE_NEWALLOC   1
  33.  
  34. // Uncomment this to use malloc-based allocator as default
  35. // #  define __STL_USE_MALLOC 1
  36.  
  37. // Uncomment this to disable using std by default
  38. // #  define __STL_NO_USING_STD 1
  39.  
  40. // define __STL_USE_ABBREVS if your linker has trouble with long 
  41. // external symbols
  42. // # define  __STL_USE_ABBREVS 1
  43.  
  44. // set this to force checked allocators
  45. // #  define __STL_DEBUG_ALLOC 1
  46.  
  47. // Mostly correct guess
  48. #  define __STL_UINT32_T unsigned long
  49.   
  50. //==========================================================
  51.  
  52. //==========================================================
  53. // default values of autoconf  flags
  54. //==========================================================
  55.  
  56. // the values choosen here as defaults try to give
  57. // maximum functionality on the most conservative settings
  58.  
  59. // Uncomment this if your compiler supports "bool"
  60. // #  define  __STL_BOOL_KEYWORD 1
  61.  
  62. // Uncomment this if your compiler has "bool" keyword reserved
  63. // #  define  __STL_RESERVED_BOOL_KEYWORD 1
  64.  
  65. // Comment this if your compiler doesn't support that
  66. #  define __STL_DEFAULT_TEMPLATE_PARAM 1
  67. // Uncomment this if your compiler support only complete types as
  68. // default parameters
  69. // #  define __STL_DEFAULT_TYPE_PARAM 1
  70.  
  71. // Comment this if your compiler lacks static data 
  72. // members template declarations 
  73. // Uncomment next line if your compiler supports __attribute__((weak))
  74. #  define __STL_STATIC_TEMPLATE_DATA 1
  75. // #  define __STL_WEAK_ATTRIBUTE 1
  76.  
  77. // Uncomment this if your C library has lrand48() function
  78. // #  define __STL_RAND48 1
  79. // Uncomment this if your compiler can't inline while(), for()
  80. // #  define __STL_LOOP_INLINE_PROBLEMS 1
  81.  
  82. // Uncomment this if your compiler supports namespaces 
  83. // #  define __STL_NAMESPACES 1
  84.  
  85. // Uncomment this if your compiler supports typename
  86. // #  define __STL_TYPENAME 1
  87.  
  88. // Uncomment this if your compiler supports mutable
  89. // #  define __STL_MUTABLE 1
  90.  
  91. // Uncomment if const_cast<> is available
  92. // #  define __STL_NEW_STYLE_CASTS 1
  93.  
  94. // Uncomment this if your compiler supports explicit constructors
  95. // #  define __STL_EXPLICIT 1
  96.  
  97. // Uncomment this if your compiler supports exceptions
  98. // #  define __STL_EXCEPTIONS 1
  99.  
  100. // Uncomment this if your compiler supports exception specifications
  101. // with reduced overhead ( e.g. inlines them, not vice versa)
  102. // #  define __STL_EXCEPTION_SPEC
  103.  
  104. // Uncomment if long long is available
  105. // #  define __STL_LONG_LONG 1
  106.  
  107. // Uncomment this for wchar_t functinality
  108. // #  define __STL_WCHAR_T  1
  109.  
  110. // Uncomment if needed full  specialization syntax : template <> struct ....
  111. // #  define __STL_FULL_SPEC_SYNTAX  1
  112.  
  113. // Uncomment if bad_alloc defined in <new>
  114. // #  define __STL_BAD_ALLOC_DEFINED  1
  115.  
  116. // Uncomment if member templates available
  117. // #  define __STL_MEMBER_TEMPLATES   1
  118.  
  119. // Uncomment if member templates available
  120. // #  define __STL_FRIEND_TEMPLATES   1
  121.  
  122. // Uncomment if available
  123. // #  define __STL_CLASS_PARTIAL_SPECIALIZATION 1
  124.  
  125. // Uncomment if available
  126. // #  define __STL_FUNC_PARTIAL_ORDERING 1
  127.  
  128. // Uncomment if available
  129. // #  define __STL_AUTOMATIC_TYPE_TRAITS 1
  130.  
  131. // Uncomment if getting errors compiling mem_fun* adaptors
  132. // #  define __STL_MEMBER_POINTER_PARAM_BUG 1
  133.  
  134. // All these settings don't affect performance/functionality
  135. // Comment them if your compiler has no problems.
  136. #  define __STL_BASE_MATCH_BUG          1
  137. // #  define __STL_NESTED_TYPE_PARAM_BUG   1
  138. #  define __STL_UNUSED_REQUIRED_BUG     1
  139. #  define __STL_UNINITIALIZABLE_PRIVATE  1
  140. #  define __STL_BASE_TYPEDEF_OUTSIDE_BUG 1
  141. #  define __STL_CONST_CONSTRUCTOR_BUG    1        
  142. // if your compiler have serious problems with typedefs, try this one
  143. // #  define __STL_BASE_TYPEDEF_BUG          1
  144. //==========================================================
  145.  
  146. //==========================================================
  147. // per-version compiler features recognition
  148. //==========================================================
  149.  
  150. // reporting of incompatibility
  151. #  define __GIVE_UP_WITH_STL(message) void give_up() ¥
  152.    { upgrade_the_compiler_to_use_STL;}
  153.  
  154.  
  155. # if defined(__sgi) && !defined(__GNUC__)
  156. #   if defined(_BOOL) || ! ((_MIPS_ISA < 2) || defined (_ABIO32))
  157. #     define __STL_BOOL_KEYWORD
  158. #   endif
  159. #   if defined(_TYPENAME)
  160. #     define __STL_TYPENAME
  161. #   endif
  162. #   ifdef _PARTIAL_SPECIALIZATION_OF_CLASS_TEMPLATES
  163. #     define __STL_CLASS_PARTIAL_SPECIALIZATION
  164. #   endif
  165. #   ifdef _MEMBER_TEMPLATES
  166. #     define __STL_MEMBER_TEMPLATES
  167. #   endif
  168. #   ifdef __EXCEPTIONS
  169. #     define __STL_USE_EXCEPTIONS
  170. #   endif
  171. #   if !defined(_NOTHREADS) && !defined(_PTHREADS)
  172. #     define __STL_SGI_THREADS
  173. #   endif
  174. # endif
  175.  
  176.  
  177. // AIX xlC, is there more specific define ?
  178. #if defined(_AIX)
  179. #  define __STL_RESERVED_BOOL_KEYWORD 1
  180. #  undef  __STL_DEFAULT_TEMPLATE_PARAM
  181. #  undef  __STL_DEFAULT_TYPE_PARAM
  182. #  undef  __STL_NAMESPACES
  183. #  undef  __STL_UNINITIALIZABLE_PRIVATE
  184. #  define __STL_UNINITIALIZABLE_PRIVATE 1
  185. #  define __STL_BASE_TYPEDEF_OUTSIDE_BUG 1
  186. #  undef  __STL_CONST_CONSTRUCTOR_BUG
  187. #  define __STL_CONST_CONSTRUCTOR_BUG 1
  188. #endif
  189.  
  190. // Microsoft Visual C++ 4.0, 4.1, 4.2, 5.0
  191. # if defined(_MSC_VER)
  192. // comment this one to try experimantal allocator
  193. // #  define __STL_USE_NEWALLOC  1
  194. #  undef  __STL_BOOL_KEYWORD
  195. #  undef  __STL_UNINITIALIZABLE_PRIVATE
  196. #  undef  __STL_BASE_MATCH_BUG
  197. #  undef  __STL_DEFAULT_TEMPLATE_PARAM
  198. #   ifdef _CPPUNWIND
  199. #     define __STL_USE_EXCEPTIONS
  200. #   endif
  201. #   if defined ( _MT ) 
  202. #     define __STL_WIN32THREADS
  203. #   endif
  204. #  if ( _MSC_VER>=1000 )
  205. #   define __STL_NAMESPACES             1
  206. #   define __STL_NEW_STYLE_CASTS        1
  207. #   undef  __STL_CONST_CONSTRUCTOR_BUG
  208. #   define __STL_CONST_CONSTRUCTOR_BUG  1
  209. #   define __STL_LONG_DOUBLE            1
  210. #   if ( _MSC_VER<=1010 )
  211. // "bool" is reserved in MSVC 4.1 while <yvals.h> absent, so :
  212. #   define __STL_RESERVED_BOOL_KEYWORD 1
  213. #   define __STL_USE_ABBREVS           1
  214. #   else
  215. #    define __STL_YVALS_H 1
  216. #    define __STL_BAD_ALLOC_DEFINED 1
  217. #   endif
  218. #  endif
  219. #  if (_MSC_VER >= 1100)  // MSVC 5.0
  220. #    define __STL_DEFAULT_TEMPLATE_PARAM 1
  221. #    define __STL_TYPENAME      1
  222. #    define __STL_EXPLICIT      1
  223. #    define __STL_MUTABLE       1
  224. #  endif
  225. # endif
  226.  
  227. // Borland C++ ( 5.x )
  228. # if defined ( __BORLANDC__ )
  229. #  undef  __STL_UNINITIALIZABLE_PRIVATE
  230. #  undef  __STL_DEFAULT_TEMPLATE_PARAM
  231. #  if ( __BORLANDC__ < 0x500 )
  232. #   undef  __STL_BOOL_KEYWORD
  233. #   undef  __STL_NAMESPACES
  234. #   undef  __STL_DEFAULT_TEMPLATE_PARAM
  235. #   undef  __STL_NESTED_TYPE_PARAM_BUG
  236. #   undef  __STL_BASE_MATCH_BUG
  237. #   define __STL_NESTED_TYPE_PARAM_BUG 1
  238. #   define __STL_BASE_MATCH_BUG        1
  239. #  else
  240. #   define __STL_BOOL_KEYWORD 1
  241. #   define __STL_DEFAULT_TYPE_PARAM 1
  242. #   define __STL_NAMESPACES 1
  243. #   define __STL_EXPLICIT   1
  244. #   define __STL_TYPENAME   1
  245. #   define __STL_USE_EXCEPTIONS 1
  246. #   define __STL_NEW_STYLE_CASTS
  247. #   define __STL_LONG_DOUBLE 1
  248. #   define __STL_MUTABLE 1
  249. #   define __STL_WCHAR_T 1
  250. #   define __STL_NEW_HEADER_NAMES 1
  251. #   undef  __STL_CONST_CONSTRUCTOR_BUG
  252. #   define __STL_CONST_CONSTRUCTOR_BUG 1
  253. #  endif
  254. #  undef  __STL_LOOP_INLINE_PROBLEMS
  255. #  define __STL_LOOP_INLINE_PROBLEMS 1
  256. // empty exception spec make things worse in BC, so:
  257. #  undef __STL_EXCEPTION_SPEC
  258. # endif
  259.  
  260. # if defined(__SUNPRO_CC)
  261. #  if ( __SUNPRO_CC <= 0x420 )
  262.    // SUNPro C++ 4.1 and above
  263. #   undef  __STL_BOOL_KEYWORD
  264. #   undef  __STL_DEFAULT_TEMPLATE_PARAM
  265. #   undef  __STL_NAMESPACES
  266. #   define __STL_USE_EXCEPTIONS     1
  267. #   undef  __STL_EXCEPTION_SPEC
  268. #   define __STL_EXCEPTION_SPEC 1
  269. #   undef  __STL_UNINITIALIZABLE_PRIVATE
  270. #   define __STL_UNINITIALIZABLE_PRIVATE 1
  271. #   define __STL_LONG_LONG  1
  272. #   define __STL_WCHAR_T  1
  273.    // SUNPro C++ prior to 4.1
  274. #   if ( __SUNPRO_CC < 0x410 )
  275.    // hard times ;(
  276. #   define __STL_BASE_MATCH_BUG          1
  277. #   define __STL_BASE_TYPEDEF_BUG        1
  278. #     if ( __SUNPRO_CC < 0x401 )
  279.         __GIVE_UP_WITH_STL(SUNPRO_401)
  280. #     endif
  281. #   else 
  282. #    if ( __SUNPRO_CC >= 0x420 )
  283. #     define __STL_FULL_SPEC_SYNTAX 1
  284. #    endif
  285. #   endif
  286.  
  287. #  endif
  288. # endif
  289.  
  290. // g++ 2.7.x and above 
  291. # if defined (__GNUC__ )
  292. #  undef   __STL_UNINITIALIZABLE_PRIVATE
  293. #  define  __STL_BOOL_KEYWORD 1
  294. // cygnus have a lot of version, let's assume the best.
  295. // no specific definitions known except this one
  296. #  if defined (__CYGWIN32__)
  297. #   define __CYGNUS_GCC__
  298. #  endif
  299.  
  300. #  if ! ( __GNUC__ > 2 || __GNUC_MINOR__ > 7 || defined (__CYGNUS_GCC__) )
  301. // Will it work with 2.6 ? I doubt it.
  302. #   if ( __GNUC_MINOR__ < 6 )
  303.     __GIVE_UP_WITH_STL(GCC_272);
  304. #   endif
  305. #   undef  __STL_NAMESPACES
  306. #   undef  __STL_DEFAULT_TEMPLATE_PARAM
  307. #   define __STL_DEFAULT_TYPE_PARAM 1
  308. #   undef  __STL_STATIC_TEMPLATE_DATA
  309. #   define __STL_NESTED_TYPE_PARAM_BUG   1
  310. #   undef  __STL_STATIC_TEMPLATE_DATA
  311. #   define __STL_BASE_MATCH_BUG       1
  312. //  unused operators are required (forward)
  313. #   undef  __STL_EXPLICIT
  314. #   define __STL_EXPLICIT 1
  315. #   undef  __STL_UNINITIALIZABLE_PRIVATE
  316. #   define __STL_UNINITIALIZABLE_PRIVATE 1
  317. #   undef  __STL_CONST_CONSTRUCTOR_BUG 
  318. #   undef  __STL_LONG_LONG
  319. #   undef  __STL_WCHAR_T 
  320. #   define __STL_LONG_LONG  1
  321. #   define __STL_WCHAR_T  1
  322. #   define __STL_MUTABLE 1
  323. #   define __STL_NEW_STYLE_CASTS 1
  324. // default for gcc-2.7.2 is no exceptions, let's follow it
  325. #  endif /* __GNUC__ > 2 */
  326.  
  327. // cygnus gcc may be as advanced as that
  328. #  if defined ( __CYGNUS_GCC__ )
  329. #   undef  __STL_DEFAULT_TEMPLATE_PARAM
  330. #   define __STL_DEFAULT_TEMPLATE_PARAM 1
  331. #   undef  __STL_STATIC_TEMPLATE_DATA
  332. #   define __STL_STATIC_TEMPLATE_DATA   1
  333. #   undef  __STL_NAMESPACES
  334. #   define __STL_EXPLICIT   1
  335. #   define __STL_TYPENAME   1
  336. #  endif 
  337.  
  338. // static template data members workaround strategy for gcc tries
  339. // to use weak symbols.
  340. // if you don't want to use that, #define __STL_WEAK_ATTRIBUTE=0 ( you'll
  341. // have to put "#define __PUT_STATIC_DATA_MEMBERS_HERE" line in one of your
  342. // compilation unit ( or CFLAGS for it ) _before_ including any STL header ).
  343. #  if !(defined (__STL_STATIC_TEMPLATE_DATA) || defined (__STL_WEAK_ATTRIBUTE ))
  344. // systems using GNU ld or format that supports weak symbols
  345. // may use "weak" attribute
  346. // Linux & Solaris ( x86 & SPARC ) are being auto-recognized here
  347. #   if defined(__STL_GNU_LD) || defined(__ELF__) || ¥
  348.     (( defined (__SVR4) || defined ( __svr4__ )) && ¥
  349.      ( defined (sun) || defined ( __sun__ )))
  350. #    define __STL_WEAK_ATTRIBUTE 1
  351. #   endif
  352. #  endif /* __STL_WEAK_ATTRIBUTE */
  353.  
  354. # endif /* __GNUC__ */
  355.  
  356.  
  357. # if defined (__WATCOM_CPLUSPLUS__)
  358. #  if (__WATCOM_CPLUSPLUS__ >= 1100 )
  359. // Can define if you enable /xs compiler option
  360. //#   if 0
  361. //#    define __STL_EXCEPTIONS 1
  362. //#    define __STL_EXCEPTION_SPEC 1
  363. //#   else
  364. //#    undef  __STL_EXCEPTIONS
  365. //#    undef  __STL_EXCEPTION_SPEC
  366. //#   endif
  367. #   define __STL_NESTED_TYPE_PARAM_BUG 1
  368. #   define __STL_BOOL_KEYWORD 1
  369. #   undef  __STL_DEFAULT_TEMPLATE_PARAM
  370. #   define __STL_STATIC_TEMPLATE_DATA 1
  371. #   define __STL_EXPLICIT 1
  372. #   undef  __STL_BASE_MATCH_BUG
  373. #   undef  __STL_BASE_TYPEDEF_BUG
  374. #   define __STL_BASE_TYPEDEF_OUTSIDE_BUG 1
  375. #   undef  __STL_UNINITIALIZABLE_PRIVATE
  376. #   define __STL_CONST_CONSTRUCTOR_BUG 1
  377. #   define __STL_NEW_HEADER_NAMES 1
  378. #   define __STL_LONG_DOUBLE 1
  379. #   define __STL_MUTABLE 1
  380. #   define __STL_NEW_STYLE_CASTS 1
  381. #   undef  __STL_UNUSED_REQUIRED_BUG
  382. #  endif
  383. # endif /* __WATCOM_CPLUSPLUS__ */
  384.  
  385. #if __MWERKS__ >= 0x1800                                            // ・・・ハJDJ
  386.  #  define SGI_STL 1                                
  387.  
  388.  #  define __STL_NO_NAMESPACES 1                                
  389.  #  define __STL_USE_NEWALLOC   1                            
  390.  #  define __STL_BOOL_KEYWORD 1                            
  391.  #  define __STL_MUTABLE 1                                    
  392.  #  define __STL_NEW_STYLE_CASTS 1                        
  393.  #  define __STL_EXPLICIT 1                                
  394.  #  define __STL_EXCEPTIONS 1                            
  395.  #  define __STL_BAD_ALLOC_DEFINED  1                    
  396.  #  define __STL_CLASS_PARTIAL_SPECIALIZATION 1        
  397.  
  398.  #  define __THROW_BAD_ALLOC
  399.  
  400.  #  undef __STL_DEFAULT_TEMPLATE_PARAM            // default template argument can't be a template type    
  401.  #  define __STL_DEFAULT_TYPE_PARAM
  402.  
  403.  #if defined(__MSL_LONGLONG_SUPPORT__)
  404.   #  define __STL_LONG_LONG 
  405.  #endif    
  406. #endif
  407.  
  408. # undef __GIVE_UP_WITH_STL
  409.  
  410. #endif
  411.